package ui2;

import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.Color;
import javax.swing.JSeparator;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.FlowLayout;

public class PanelPc extends JPanel{

	/**
	 * 
	 */
	private static final long serialVersionUID = -3585458997394568117L;
	private JFrame frame;
	//private JPanel panelPc;

   	
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					PanelPc window = new PanelPc();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public PanelPc(int cpuNumber, int frequency, int memory) {
		super();
		initialize(cpuNumber, frequency, memory);
	}
	
	public PanelPc() {
		super();
		initialize(2, 2500, 8000);
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize(int cpuNumber, int frequency, int memory) {
		frame = new JFrame();
		frame.setBounds(100, 100, 800, 550);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		
		//JPanel panelPc = new JPanel();
		frame.getContentPane().add(this);
		GridBagLayout gbl_panelPc = new GridBagLayout();
		gbl_panelPc.columnWidths = new int[]{357, 52, 379, 0};
		gbl_panelPc.rowHeights = new int[]{44, 17, 17, 12, 111, 17, 58, 17, 49, 17, 0};
		gbl_panelPc.columnWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panelPc.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		this.setLayout(gbl_panelPc);
		
		JLabel label = new JLabel("View your personal configuration:");
		label.setForeground(Color.RED);
		label.setFont(new Font("Tahoma", Font.BOLD, 15));
		GridBagConstraints gbc_label = new GridBagConstraints();
		gbc_label.fill = GridBagConstraints.VERTICAL;
		gbc_label.insets = new Insets(0, 0, 5, 0);
		gbc_label.gridwidth = 3;
		gbc_label.gridx = 0;
		gbc_label.gridy = 1;
		this.add(label, gbc_label);
		
		JLabel label_1 = new JLabel("other Nodes can choose you reading this internal components");
		label_1.setForeground(Color.RED);
		label_1.setFont(new Font("Tahoma", Font.BOLD, 15));
		GridBagConstraints gbc_label_1 = new GridBagConstraints();
		gbc_label_1.fill = GridBagConstraints.VERTICAL;
		gbc_label_1.insets = new Insets(0, 0, 5, 0);
		gbc_label_1.gridwidth = 3;
		gbc_label_1.gridx = 0;
		gbc_label_1.gridy = 2;
		this.add(label_1, gbc_label_1);
		
		JSeparator separator = new JSeparator();
		GridBagConstraints gbc_separator = new GridBagConstraints();
		gbc_separator.anchor = GridBagConstraints.NORTH;
		gbc_separator.fill = GridBagConstraints.HORIZONTAL;
		gbc_separator.insets = new Insets(0, 0, 5, 0);
		gbc_separator.gridwidth = 3;
		gbc_separator.gridx = 0;
		gbc_separator.gridy = 3;
		this.add(separator, gbc_separator);
		
		JLabel lblNumberOfCpu = new JLabel("Number of CPU:");
		lblNumberOfCpu.setFont(new Font("Tahoma", Font.PLAIN, 15));
		GridBagConstraints gbc_lblNumberOfCpu = new GridBagConstraints();
		gbc_lblNumberOfCpu.anchor = GridBagConstraints.EAST;
		gbc_lblNumberOfCpu.fill = GridBagConstraints.VERTICAL;
		gbc_lblNumberOfCpu.insets = new Insets(0, 0, 5, 5);
		gbc_lblNumberOfCpu.gridx = 0;
		gbc_lblNumberOfCpu.gridy = 5;
		this.add(lblNumberOfCpu, gbc_lblNumberOfCpu);
		
		JLabel label_3 = new JLabel(String.valueOf(cpuNumber));
		label_3.setFont(new Font("Lucida Grande", Font.PLAIN, 15));
		GridBagConstraints gbc_label_3 = new GridBagConstraints();
		gbc_label_3.anchor = GridBagConstraints.WEST;
		gbc_label_3.fill = GridBagConstraints.VERTICAL;
		gbc_label_3.insets = new Insets(0, 0, 5, 0);
		gbc_label_3.gridx = 2;
		gbc_label_3.gridy = 5;
		this.add(label_3, gbc_label_3);
		
		JLabel lblFrequency = new JLabel("Frequency:");
		lblFrequency.setFont(new Font("Tahoma", Font.PLAIN, 15));
		GridBagConstraints gbc_lblFrequency = new GridBagConstraints();
		gbc_lblFrequency.anchor = GridBagConstraints.EAST;
		gbc_lblFrequency.fill = GridBagConstraints.VERTICAL;
		gbc_lblFrequency.insets = new Insets(0, 0, 5, 5);
		gbc_lblFrequency.gridx = 0;
		gbc_lblFrequency.gridy = 7;
		this.add(lblFrequency, gbc_lblFrequency);
		
		JLabel label_5 = new JLabel(String.valueOf(frequency));
		label_5.setFont(new Font("Lucida Grande", Font.PLAIN, 15));
		GridBagConstraints gbc_label_5 = new GridBagConstraints();
		gbc_label_5.anchor = GridBagConstraints.WEST;
		gbc_label_5.fill = GridBagConstraints.VERTICAL;
		gbc_label_5.insets = new Insets(0, 0, 5, 0);
		gbc_label_5.gridx = 2;
		gbc_label_5.gridy = 7;
		this.add(label_5, gbc_label_5);
		
		JLabel lblMemory = new JLabel("Memory:");
		lblMemory.setFont(new Font("Tahoma", Font.PLAIN, 15));
		GridBagConstraints gbc_lblMemory = new GridBagConstraints();
		gbc_lblMemory.anchor = GridBagConstraints.EAST;
		gbc_lblMemory.fill = GridBagConstraints.VERTICAL;
		gbc_lblMemory.insets = new Insets(0, 0, 0, 5);
		gbc_lblMemory.gridx = 0;
		gbc_lblMemory.gridy = 9;
		this.add(lblMemory, gbc_lblMemory);
		
		JLabel label_7 = new JLabel(String.valueOf(memory));
		label_7.setFont(new Font("Lucida Grande", Font.PLAIN, 15));
		GridBagConstraints gbc_label_7 = new GridBagConstraints();
		gbc_label_7.anchor = GridBagConstraints.WEST;
		gbc_label_7.fill = GridBagConstraints.VERTICAL;
		gbc_label_7.gridx = 2;
		gbc_label_7.gridy = 9;
		this.add(label_7, gbc_label_7);
	}

}
